/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2022并保留所有权利。
 * Copyright 2022, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.suanfa.test.test;

import java.util.*;

public class Main1 {
    public static String sort(String str) {
        String[] tmp = str.split(" ");
         System.out.println(tmp[0]);
        System.out.println(tmp[1]);
        List<Character> inOrder = new ArrayList<>();
         List<Character> posOrder = new ArrayList<>();      
        for (char ch : tmp[0].toCharArray()) {
            if (Character.isLetter(ch)) {
                posOrder.add(ch);
            }
        }  
        for (char ch : tmp[1].toCharArray()) {
            if (Character.isLetter(ch)) {
                inOrder.add(ch);
            }
        } 
        inOrder.sort(new Comparator<Character>() {
            public int compare(Character o1, Character o2) {
                return Character.toLowerCase(o1) - Character.toLowerCase(o2);
            }
        });       
        StringBuilder result = new StringBuilder();
        for (int i = 0, j = 0; i < str.length(); i++) {
            if (Character.isLetter(str.charAt(i))) {
                result.append(inOrder.get(j++));
            }
            else {
                result.append(str.charAt(i));
            }
        }
        return result.toString();
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str = in.nextLine();
            String res = sort(str);
            System.out.println(res);
        }
    } 
}
